The invention relates to signal processing, and in particular to methods and apparatus for filtering signals, for example, to reduce the effects of noise, such as Gaussian noise and transient noise (spikes), in signals.
Signal processing is commonly performed in almost every field of electronics. A common task of signal processing is to filter input signals, e.g. signals derived from a measurement circuit or from a signal reproduction device. By way of example only, the following description will focus on the application of signal processing techniques to input signals representing measurements of capacitive coupling derived from a capacitance measurement circuit in a capacitive sensor application. However, it will be appreciated that the principles described herein may equally be applied to the processing of signals in any field of signal processing, e.g., in the fields of audio and/or video processing, computing, telecommunication systems, and so on.
A capacitance measurement circuit in a capacitive sensor will generally provide a series of measured signals S(t) representing measurements of the capacitive coupling C(t) of a sensor electrode to either a system ground or another electrode (depending on the technology employed). A pointing object, e.g. a user's finger, in the vicinity of the sensor electrode will modify this capacitive coupling, and so cause a change in the measured signals S(t). Thus changes in the measured signals S(t) are indicative of the presence of a pointing object, and a controller of a device incorporating the capacitance measurement circuit may respond accordingly, e.g. to activate a function associated with sensor electrode. In other types of sensor the measured signals may represent an estimated position of an object along the sensor. However, the exact nature of the sensor technology, and of what the measured signals represent, is not significant for the purposes of this description.
FIG. 1 is a plot schematically representing the capacitive coupling C of a sensor electrode in a capacitive sensor as a function of time t as an object, e.g. a user's finger, is held within the sensitive area of the sensor for around 1 second and then removed. This may, for example, represent the situation where a user temporarily places their finger over the sensor electrode to activate some function of a device incorporating the capacitive sensor.
The capacitive coupling C is plotted in arbitrary units and is shown for period of three seconds. In this example the capacitive coupling C is taken to have a background value (when the user's finger is not adjacent the sensor electrode) of around 100 units. The approach of the user's finger at around t=1 s causes the capacitive coupling C to rise to around 120 units with a rise time of around 30 ms. The capacitive coupling remains around 120 units until the user removes their finger at around t=2 s. This causes the capacitive coupling to fall back to the background level of around 100 units, again on a timescale of around 30 ms. The output S from a measurement circuit configured to measure the capacitive coupling C would ideally track the curve shown in FIG. 1, e.g. so that a controller may identify the change in capacitive coupling and respond accordingly.
FIG. 2 is a plot schematically representing the signal S(t) that might typically be determined by a measurement circuit for the capacitive coupling variation plotted in FIG. 1. The capacitance measurement circuit in this example is assumed to be configured to provide an 8-bit digitised representation of the measured capacitance signal with a measurement made (i.e. a sample) every 5 ms. Also shown as a dotted line in FIG. 2 is the capacitive coupling C of FIG. 1 with a −50 units offset. This is included in FIG. 2 for ease of comparison.
As can be seen from FIG. 2, the measured signal S(t) does not exactly follow the true capacitive coupling C of FIG. 1 but includes a noise component. In this example the modelled noise is assumed to comprise a Gaussian component with a root mean square (RMS) variation of around 4 counts, and a series of randomly placed transient components (spikes) of varying heights (up to around 80 units). In this example the transient components are all positive going, but this is not of particular significance.
Thus FIG. 2 may be considered to represent a signal that might be measured in a typical implementation of a capacitive sensor. The signal is not intended to accurately reflect any particular sensor technology, usage conditions or noise characteristics, but is merely presented as an example signal to be used for the purposes of this description.
A common desire in the field of signal processing is to reduce the effects of signal noise such as that shown in FIG. 2, i.e. noise filtering. What is more, in many situations there is a desire to implement filtering schemes in simple hardware, i.e. without requiring complex processor components.
FIG. 3 is a plot schematically representing a filtered signal Fsmooth(t) obtained by applying a conventional smoothing filter to the signal S plotted in FIG. 2. The capacitive coupling C of FIG. 1 is again shown by a dotted line (offset by −50 units). This is to allow comparison between the filtered signal Fsmooth and the capacitive coupling C the signal is intended to represent. The smoothing filter in this example is a simple moving-mean filter (box-car average filter). The moving-mean is determined by calculating the average of each sample of the measured signal S and the preceding eight samples. Thus the smoothing filter here is a nine-bin moving mean filter which may be applied in real time (i.e. it does not rely on future signal values).
The smoothing filter of FIG. 3 can be seen to be relatively effective at reducing Gaussian noise, but less effective at dealing with the transient noise events. The transient events are simply smeared out over a greater number of bins and are still readily apparent. Increasing the length of the moving-mean filter can improve the filtering characteristics, but at the cost of reduced temporal response. This is because changes in signal occurring on a timescale less than the size of the moving-mean window become blurred. A further drawback of the smoothing filter for many applications is that the averaging function requires a level of hardware complexity (e.g. a floating point processor) that is not desired. For example, in many cases there may be a desire, e.g. for cost saving reasons, to perform signal acquisition and processing using only a simple 8-bit microcontroller having no floating point processor. Thus not only does the smoothing filter of FIG. 3 perform relatively poorly, at least for a signal having the characteristics shown in FIG. 2, the filter function also requires relatively complex hardware. More advanced filtering algorithms, e.g. elliptic filters, may perform better than the simple smoothing filter example of FIG. 3, but these also require relatively complex hardware.
FIG. 4 is a plot schematically representing a filtered signal Fslew10 obtained by applying a conventional slew-rate limiting filter to the signal S plotted in FIG. 2. The capacitive coupling C of FIG. 1 is again shown for ease of comparison. A slew-rate limiting filter operates by restricting (capping) the maximum signal change that may occur between signal samples. Thus if a measured signal S is greater than a previously determined filtered signal by an amount greater than a pre-defined slew limit, the measured signal is replaced by the previously determined filtered signal plus the slew limit. Likewise, if a measured signal S is less than a previously determined filtered signal by an amount greater than a pre-defined slew limit, the measured signal is replaced by the previously determined filtered signal less the slew limit. The example slew filtered signal Fslew10 shown in FIG. 4 is generated by capping signal changes between samples of the signal shown in FIG. 2 at 10 units (i.e. the slew limit is 10 units).
The slew-rate limiting filter of FIG. 4 can be seen to be effective at reducing the transient noise events, but is less effective at dealing with the Gaussian noise. The RMS variation in the assumed Gaussian noise in this example is two to three times less than the slew limit. This means the restriction provided by the slew limit has no effect on the majority of the Gaussian noise variations between samples and so they remain in the signal. One way of increasing the effectiveness of the slew-rate limited filter in filtering the Gaussian noise is to reduce the slew-limit to less than the RMS variation in the Gaussian noise.
FIG. 5 is similar to and will be understood from FIG. 4, but shows a filtered signal Fslew1 obtained by applying a conventional slew-rate limiting filter to the signal S plotted in FIG. 2 with a slew limit of 1 unit (as opposed to 10 units as in FIG. 4). Thus changes between samples in the filtered signal Fslew1 are limited to +/−1 unit. This is less than the RMS value of the Gaussian noise, and so the filter is more effective at filtering this component of the signal S. Thus the slew-rate limiting filter of FIG. 5 is effective at reducing transient noise events and Gaussian noise. However, a drawback of the low slew limit is that the filter is not able to respond quickly to “real” changes in the signal. This is because the low slew limit prevents the filtered signal from changing quickly enough to track rapid changes in the signal S. For example the rise time of the “true” capacitive coupling C at around t=1 s is on the order of 30 ms, whereas the rise time of the slew-rate limited filtered signal Fslew1 here is around 150 ms. This slow response characteristic can be detrimental, or even unacceptable, in may situations.
There is therefore a need for filtering schemes which may be implemented in relatively simple hardware, but which do not suffer from the above-noted drawbacks of conventional filtering schemes.